package com.maben.thread.callable;

import java.util.concurrent.Callable;

/**
 * 与runnable的区别就是：
 *   1、可以有返回值
 *   2、可以排除异常
 */
public class MyCallable implements Callable<Integer> {
    @Override
    public Integer call() throws Exception {
        int sum = 0;
        for (int i = 0; i <= 10; i++) {
            sum += i;
            Thread.sleep(50);
        }
        return sum; // 返回计算结果
    }
}